package com.hl.order.controller;

import java.util.List;
import java.io.IOException;
import javax.servlet.http.HttpServletResponse;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.log.annotation.Log;
import com.ruoyi.common.log.enums.BusinessType;
import com.ruoyi.common.security.annotation.RequiresPermissions;
import com.hl.order.domain.ShopInfoChange;
import com.hl.order.service.IShopInfoChangeService;
import com.ruoyi.common.core.web.controller.BaseController;
import com.ruoyi.common.core.web.domain.AjaxResult;
import com.ruoyi.common.core.utils.poi.ExcelUtil;
import com.ruoyi.common.core.web.page.TableDataInfo;

/**
 * 店铺信息变更记录Controller
 * 
 * @author ruoyi
 * @date 2025-08-11
 */
@RestController
@RequestMapping("/shopInfoChange")
public class ShopInfoChangeController extends BaseController
{
    @Autowired
    private IShopInfoChangeService shopInfoChangeService;

    /**
     * 查询店铺信息变更记录列表
     */
    @RequiresPermissions("order:shopInfoChange:list")
    @GetMapping("/list")
    public TableDataInfo list(ShopInfoChange shopInfoChange)
    {
        startPage();
        List<ShopInfoChange> list = shopInfoChangeService.selectShopInfoChangeList(shopInfoChange);
        return getDataTable(list);
    }

    /**
     * 导出店铺信息变更记录列表
     */
    @RequiresPermissions("order:shopInfoChange:export")
    @Log(title = "店铺信息变更记录", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, ShopInfoChange shopInfoChange)
    {
        List<ShopInfoChange> list = shopInfoChangeService.selectShopInfoChangeList(shopInfoChange);
        ExcelUtil<ShopInfoChange> util = new ExcelUtil<ShopInfoChange>(ShopInfoChange.class);
        util.exportExcel(response, list, "店铺信息变更记录数据");
    }

    /**
     * 获取店铺信息变更记录详细信息
     */
    @RequiresPermissions("order:shopInfoChange:query")
    @GetMapping(value = "/{shopChangeId}")
    public AjaxResult getInfo(@PathVariable("shopChangeId") Long shopChangeId)
    {
        return success(shopInfoChangeService.selectShopInfoChangeByShopChangeId(shopChangeId));
    }

    /**
     * 新增店铺信息变更记录
     */
    @RequiresPermissions("order:shopInfoChange:add")
    @Log(title = "店铺信息变更记录", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody ShopInfoChange shopInfoChange)
    {
        return toAjax(shopInfoChangeService.insertShopInfoChange(shopInfoChange));
    }

    /**
     * 修改店铺信息变更记录
     */
    @RequiresPermissions("order:shopInfoChange:edit")
    @Log(title = "店铺信息变更记录", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody ShopInfoChange shopInfoChange)
    {
        return toAjax(shopInfoChangeService.updateShopInfoChange(shopInfoChange));
    }

    /**
     * 删除店铺信息变更记录
     */
    @RequiresPermissions("order:shopInfoChange:remove")
    @Log(title = "店铺信息变更记录", businessType = BusinessType.DELETE)
	@DeleteMapping("/{shopChangeIds}")
    public AjaxResult remove(@PathVariable Long[] shopChangeIds)
    {
        return toAjax(shopInfoChangeService.deleteShopInfoChangeByShopChangeIds(shopChangeIds));
    }
}
